home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000145_icon-group-sender _Wed Jul 22 17:37:52 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id RAA27739
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 22 Jul 1998 17:37:51 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA04329; Wed, 22 Jul 1998 17:37:35 -0700
Message-Id: <3.0.5.32.19980722163020.00a5fbc0@post.its.mcw.edu>
X-Sender: cdt@post.its.mcw.edu
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.5 (32)
Date: Wed, 22 Jul 1998 16:30:20
To: Kostas Oikonomou <ko@mara.ho.att.com>, icon-group@optima.CS.Arizona.EDU
From: Chris Tenaglia <cdt@post.its.mcw.edu>
Subject: Re: Reading numbers from a file
In-Reply-To: <13747.39630.559540.280143@mara>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 1212
try a variation of this:
------------------------------
#
# read space delimited lines of numbers
#
procedure main()
while line := read() do
{
numbers := parse(line,' ') #split the
line into numbers
every value := !numbers do process(value) # process each number
}
end
#
# parse a string into a list with respect to a delimiter
#
procedure parse(line,delims)
static chars
chars := &cset -- delims
tokens := []
line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
return tokens
end
#
# whatever
#
procedure process(n)
..........
end
-----------------------------------
At 03:35 PM 7/20/98 -0400, Kostas Oikonomou wrote:
>
>Hello,
>
>This is probably a dumb question, but there doesn't seem to be an easy way to
>read a numbers from a file with Icon. I mean a file consisting of lines,
each
>line being a list of numbers (integers or reals), separated by blanks.
>
>I finally wrote my own routine, but I don't want to reinvent thw wheel...
>
>(I looked in the procs/ library, and found pack/unpack in binary.icn. But I
>don't see how to get unpack to do what I want.)
>
>Thanks for your help.
>
> Kostas Oikonomou
>
>